package com.cy.api;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class ListGenericTest {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<String> list = new ArrayList<>();


        Class<? extends ArrayList> c = list.getClass();
        Method add = c.getDeclaredMethod("add", Object.class);
        add.invoke(list,100);
        System.out.println(list);
    }
}
